﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace WisDom.Models
{
    /// <summary>
    /// 审计数据
    /// </summary>
    public class AuditEntity
    {
        /// <summary>
        /// 审计编号
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 表名
        /// </summary>
        public string TableName { get; set; }

        /// <summary>
        /// 操作时间
        /// </summary>
        public DateTime? OperTime { get; set; }

        /// <summary>
        /// 具体操作噢=
        /// </summary>
        public string OperationString
        {
            get
            {
                return operation.ToString();
            }
            set
            {
                operation = Enum.Parse<Operation>(value, true);
            }
        }


        public string KeyValues { get; set; }

        public string OldValues { get; set; }

        public string NewValues { get; set; }

        [NotMapped]
        public Operation operation { get; set; }

    }

    public enum Operation
    {
        Add = 0,
        Delete = 1,
        Modified = 2
    }
}
